// Main file here... I hope....

/* to check framerate (1)
double GLO_time;
double cur_time = 0;
*/

short but = 0;

#include "drawclass.hpp"
#include "Euler.hpp"
//#include "wprint_func.cpp"


using namespace std;



int main(int argc, char** argv)
{

	uint size, wsize;
	point* Apoint = NULL;
	getpoints(Apoint, size);
	wire* Awire = NULL;
	getwires(Awire, wsize, Apoint, size);
	Cdrawing screen(Apoint, size, Awire, wsize);

    CRK4 mover(Apoint, size, Awire, wsize);

	if(!screen.init(WIDTH, HEIGH)){
		delete[] Apoint;
		delete[] Awire;
		printf("init failed, main arrays deleted");
		return 0;
	};

	/* to check framerate (2)
	GLO_time = glfwGetTime();
	cur_time = GLO_time;
	*/

// ok, I know this doesn't look nice yet...
	while(!screen.exit()) {
		if(screen.time()) {

		    /* to check framerate (3)
		    printf("%f ", cur_time - GLO_time);
		    printf("%f \n", glfwGetTime() - cur_time);
		    cur_time = glfwGetTime();
		    */
            screen.mouse_but();
            while(but) {
                screen.draw();
                screen.mouse_but();
            }
            screen.draw();
            printf("draws ");
			//if(!but)
			mover.solve(0.05, 0.1);
		}
	}
	//printw(Awire, wsize);
	screen.kill();
	delete[] Apoint;
	delete[] Awire;
}
